"ByRef portname as Byte", the define maybe wrong, so that you can not get he right port. 
Please try this one:  "ByRef portname as String"

In order to tail your error infromation, please try the API i am sending to you now.  When the USB returns 1, then it should be correct.

CreateFile(portname, GENERIC_READ|GENERIC_WRITE,0, NULL, OPEN_EXISTING, 0, NULL) will return 9, and will return error code 8 when the port setting is wrong. Return error code 7 when DCB setting is wrong. Return error 6 when the buffer setting is wrong. Return error code 5 when reading is over time. Return error code 4 when setting is over time. Correct should return 0.

The code of "MF_InitComm" in our original program is :

int _stdcall MF_InitComm(char* portname, long baud)//Opne the retated port
{
if ((memcmp(portname, "USB", 3)== 0) || (memcmp(portname, "usb", 3) == 0))
    {
        flag_usb = 1;
        return flag_usb;
    }
    else
    {
        flag_usb = 0;
    }

    idComDev = CreateFile(portname, GENERIC_READ|GENERIC_WRITE,
		        	0, NULL, OPEN_EXISTING, 0, NULL);
    if (idComDev==INVALID_HANDLE_VALUE)
	    ////	return Code_SetCommPortErr;						// Initiate the port is wrong
            return 9;
	if (GetCommState(idComDev,&lpDCB)==FALSE)
	   //	return Code_SetCommPortErr;
           return 8;						//Getting port setting is wrong
	lpDCB.BaudRate =baud;
	lpDCB.ByteSize  =8;
    lpDCB.Parity =NOPARITY;
	lpDCB.StopBits =ONESTOPBIT;
	if (SetCommState(idComDev,&lpDCB)==FALSE)
     // //  return Code_SetCommPortErr;		            //Setting DCB is wrong
          return 7;
    if (SetupComm(idComDev,1024,1024)==FALSE)
    // //   return Code_SetCommPortErr;		            //Setting buffer is wrong
       return 6;
    if (GetCommTimeouts(idComDev,&TIMETEST)==FALSE)
   // ////    return Code_SetCommPortErr;		            //Reading over time error
        return 5;
	TIMETEST.ReadIntervalTimeout = 100;              //Reading time space over time 
	TIMETEST.ReadTotalTimeoutMultiplier = 1;        //Read total time over time constant 
    TIMETEST.ReadTotalTimeoutConstant = 3000;       //Read total time over time constant  
    TIMETEST.WriteTotalTimeoutConstant =100;        //Write total time over time constant
	TIMETEST.WriteTotalTimeoutMultiplier =100;      //Write total time over time constant
    if (SetCommTimeouts(idComDev,&TIMETEST)==FALSE)
   //  //	    return Code_SetCommPortErr;		            //Set time out error
      return 4;
    else
		return 0;
}


Please check this and for your reference.
Regards
